package com.util;

import javax.servlet.http.HttpSession;

public class TlManager {
    private static ThreadLocal<HttpSession> sessionTl=new ThreadLocal<>();
    public static HttpSession getSessionTl(){
        HttpSession session=sessionTl.get();
        return session;
    }
    public static void setSessionTl(HttpSession session){
        HttpSession _session=sessionTl.get();
        if(_session==null){
            sessionTl.set(session);
        }
    }

    public static void close(){
        HttpSession session=sessionTl.get();
        if(session!=null){
            sessionTl.remove();
        }
    }
}
